<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>附件数据管理</title>
<link href="css_body.css" rel="stylesheet" type="text/css" />
<style>
.napisdiv {left:10;top:0;width:150;height:100;position:absolute;z-index:3}
.imglit {
   max-height: 100px; height:expression(this.height > 100 ? "100px" : this.height) ;      
}
</style>
<script>
function $DE(eid){ return document.getElementById(eid); }
function ChangeImage(surl){ $DE('picview').src = surl; }
	//获得选中文件的文件名
function getCheckboxItem(){
	 var allSel="";
	 if(document.form1.aids.value) return document.form1.aids.value;
	 for(i=0;i<document.form1.aids.length;i++)
	 {
		 if(document.form1.aids[i].checked){
			 if(allSel=="")
				 allSel=document.form1.aids[i].value;
			 else
				 allSel=allSel+","+document.form1.aids[i].value;
		 }
	 }
	 return allSel;	
}

function AllSel(){
	for(i=0;i<document.form1.aids.length;i++){
		document.form1.aids[i].checked = true;
	}
}

function NoneSel(){
	for(i=0;i<document.form1.aids.length;i++){
		document.form1.aids[i].checked = false;
	}
}

function DelSel(){
	 var nid = getCheckboxItem();
	 if(nid==""){
		  alert("请选择项目!\r\n");
		  return ;
	 }
	 location.href = "media_edit.php?dopost=del&ids="+nid;
}
</script>
</head>
<body>
<div class="bodytitle">
	<div class="bodytitleleft"></div>
	<div class="bodytitletxt">文档维护</div>
</div>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="background:#E2F5BC;margin-top:8px">
  <tr> 
    <td height="19" colspan="7" bgcolor="#EDF9D5">
<table width='96%' border="0" cellpadding='0' cellspacing='0'>
	  <tr>
    		<td width='30%' style='padding-left:6px'><b>附件数据管理</b></td>
        <td align='right'>
    	  [<a href="media_add.php"><u>上传新文件</u></a>]
        </td>
      </tr>
     </table>
     </td>
  </tr>
  <tr bgcolor="#F2FAE2" height="24"> 
    <td colspan="7">
	<table width="600" border="0" cellspacing="0" cellpadding="0">
        <form name='forms' method='post' action='media_main.php'>
        <tr> 
          <td width="10">&nbsp;</td>
          <td width="70" height="30" align="center">关键字：</td>
          <td width="100"><input name="keyword" type="text" id="keyword" style="width:100" value="<?php echo $keyword?>"></td>
          <td width="100" align="center">
		  <select name='mediatype' style='width:80'>
              <option value='0'>文件类型</option>
              <option value='1'<?php if($mediatype==1) echo " selected"?>>图片</option>
              <option value='2'<?php if($mediatype==2) echo " selected"?>>FLASH</option>
              <option value='3'<?php if($mediatype==3) echo " selected"?>>视频/音频</option>
              <option value='4'<?php if($mediatype==4) echo " selected"?>>其它附件</option>
            </select> </td>
          <td width="100" align="center">
		  <select name='membertype' style='width:80'>
              <option value='0'>用户组</option>
              <option value='1'<?php if($membertype==1) echo " selected"?>>管理员</option>
              <option value='2'<?php if($membertype==2) echo " selected"?>>外部会员</option>
		</select>
		  </td>
          <td height="30"><input name="imageField" type="submit" class="inputbut" value="搜索"></td>
        </tr>
      </form>
      </table>
    </td>
  </tr>
  <tr bgcolor="#F8FBFB" height="24" align="center"> 
    <td width="8%">选择</td>
    <td width="28%">文件标题</td>
    <td width="10%">文件大小</td>
    <td width="15%">上传会员</td>
    <td width="15%">上传时间</td>
    <td width="9%">文件类型</td>
    <td width="15%">管理</td>
   </tr>
   <form name='form1'>
  <?php 
$mylist = $dlist->GetDataList();
$i = 0;
while($row = $mylist->GetArray('dm'))
{
$i++;
?>
  <tr align="center" bgcolor="#FFFFFF" height="24" onMouseMove="javascript:this.bgColor='#EFEFEF';" onMouseOut="javascript:this.bgColor='#FFFFFF';"> 
    <td>
    	<input type='checkbox' name='aids' id='aids<?php echo $row['aid']?>' value='<?php echo $row['aid']?>' class='np'/>
    </td>
    <td>
    	<a href='<?php echo $row['url']?>' title='<?php echo $row['url']?>' target='_blank'>
      <?php 
      if(eregi("\.(jpg|gif|png)",$row['url'])){
      	echo "<img src='".$row['url']."' id='n{$i}' border='0' width='100' class='imglit'/><br />";
      }
      ?>
      <u><?php echo $row['title']?></u>
    	</a>
    </td>
    <td><?php echo GetFileSize($row['filesize'])?></td> 
    <td><?php echo UploadAdmin($row['adminname'],$row['membername'])?></td>
    <td><?php echo strftime("%y-%m-%d %H:%M",$row['uptime'])?></td>
    <td><?php echo MediaType($row['mediatype'],$row['url'])?></td>
    <td>
    	<a href='media_edit.php?aid=<?php echo $row['aid']?>&dopost=edit'>更改</a> 
      |
      <a href='media_edit.php?aid=<?php echo $row['aid']?>&dopost=del'>删除</a> 
    </td>
     </tr>
		<?php 
	}
		?>
  <tr bgcolor="#F8FBFB" height="24"> 
   <td height="30" colspan="7" style="padding-top:6px">
    &nbsp; <input type="button" name="b4" value="全选" class="inputbut" style="width:40" onClick="AllSel();"> 
    &nbsp; <input type="button" name="b5" value="取消" class="inputbut" style="width:40" onClick="NoneSel();"> 
    &nbsp; <input type="button" name="b6" value="删除所选" class="inputbut" style="width:80" onClick="DelSel();">   </td>
  </tr>
  <tr bgcolor="#EEFAC9" height="24"> 
    <td colspan="7" align="center" bgcolor="#EDF9D5" height="48">
    	<?php echo $dlist->GetPageList(5);?> 
	</td>
  </tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>